/*    */ package com.zimbra.qa.unittest;
/*    */ 
/*    */ import com.google.common.collect.Lists;
/*    */ import java.util.List;
/*    */ import org.junit.runner.Description;
/*    */ import org.junit.runner.notification.Failure;
/*    */ import org.junit.runner.notification.RunListener;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class TestResults
/*    */   extends RunListener
/*    */ {
/*    */   private long lastTestStartTime;
/*    */   private boolean lastTestSucceeded;
/*    */   private String lastErrorMessage;
/*    */   
/*    */   public static class Result
/*    */   {
/*    */     public final String className;
/*    */     public final String methodName;
/*    */     public final long execMillis;
/*    */     public final boolean success;
/*    */     public final String errorMessage;
/*    */     
/*    */     private Result(String className, String methodName, long execMillis, boolean success, String errorMessage)
/*    */     {
/* 38 */       this.className = className;
/* 39 */       this.methodName = methodName;
/* 40 */       this.execMillis = execMillis;
/* 41 */       this.success = success;
/* 42 */       this.errorMessage = errorMessage;
/*    */     }
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/* 50 */   private List<Result> results = Lists.newArrayList();
/*    */   
/*    */   public List<Result> getResults(boolean success) {
/* 53 */     List<Result> list = Lists.newArrayList();
/* 54 */     for (Result result : this.results) {
/* 55 */       if (result.success == success) {
/* 56 */         list.add(result);
/*    */       }
/*    */     }
/* 59 */     return list;
/*    */   }
/*    */   
/*    */   public void testStarted(Description description) throws Exception
/*    */   {
/* 64 */     this.lastTestStartTime = System.currentTimeMillis();
/* 65 */     this.lastTestSucceeded = true;
/* 66 */     this.lastErrorMessage = null;
/*    */   }
/*    */   
/*    */   public void testFinished(Description desc) throws Exception
/*    */   {
/* 71 */     this.results.add(new Result(desc.getClassName(), desc.getMethodName(), System.currentTimeMillis() - this.lastTestStartTime, this.lastTestSucceeded, this.lastErrorMessage, null));
/*    */   }
/*    */   
/*    */   public void testFailure(Failure failure)
/*    */     throws Exception
/*    */   {
/* 77 */     this.lastTestSucceeded = false;
/* 78 */     this.lastErrorMessage = failure.getMessage();
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/qa/unittest/TestResults.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */